﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.Design;
using ProgNetDxComponents.Design.Creators;

namespace ProgNetDxComponents.Design.Designers
{
    public class EditCreatorDesigner : ComponentDesigner
    {
        public override DesignerVerbCollection Verbs
        {
            get
            {
                DesignerVerbCollection v = new DesignerVerbCollection();
                v.Add(new DesignerVerb("Create Editors", new EventHandler(CreateEditors)));
                return v;
            }
        }

        private void CreateEditors(object sender, EventArgs e)
        {
            CreateEditorsForm f = new CreateEditorsForm();
            EditCreator creator = Component as EditCreator;
            if (creator != null)
            {
                f.Designer = GetService(typeof(IDesignerHost)) as IDesignerHost;
                f.DataSet = creator.DataSet;
                f.OptionProvider = creator.OptionProvider;
                f.LanguageProvider = creator.LanguageProvider;
                f.ParentContainer = creator.Parent;
            }
            f.ShowDialog();
        }
    }
}
